//
//  ViewByHpTitleViewController.m
//  One
//
//  Created by mac on 16/5/24.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "ViewByHpTitleViewController.h"
#import "SCVView.h"

@interface ViewByHpTitleViewController ()

@end

@implementation ViewByHpTitleViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    self.title = @"ONE";
    self.navigationItem.leftBarButtonItem.customView.backgroundColor = [UIColor redColor];
    
    SCVView *showView = [[SCVView alloc]initWithHpObj:_hpObj];
    showView.frame = CGRectMake(10, 0, WIDTH, HEIGHT - 64-120);
    [_contentView addSubview:showView];
    
    _praiseNumLabel.text = [NSString stringWithFormat:@"%d",_hpObj.praisenum];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (IBAction)praiseButtonClick:(UIButton *)sender {
    
    sender.selected = !sender.selected;
    if (sender.isSelected) {
        _praiseNumLabel.text = [NSString stringWithFormat:@"%d",_hpObj.praisenum + 1];
    }
    else
    {
        _praiseNumLabel.text = [NSString stringWithFormat:@"%d",_hpObj.praisenum - 1];
    }
}

@end
